package com.lin.controller;


import com.lin.entity.Department;
import com.lin.entity.User;
import com.lin.reponse.Result;
import com.lin.service.DepartmentService;
import com.lin.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.sql.ResultSet;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Lin
 * @since 2022-03-01
 */
@Api(tags = "部门管理")
@RestController
@RequestMapping("/department")
@CrossOrigin
public class DepartmentController {

    @Resource
    private DepartmentService departmentService;

    @ApiOperation(value = "部门查询",notes = "获取部门分组以及人数")
    @GetMapping("/findAll")
    public Result findAll(){
        List<Department> deptAndCount = departmentService.findDeptAndCount();
        return Result.ok().data("deptAndCount",deptAndCount);
    }


}

